import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;

import javax.swing.*;

/**
 * 
 */

/**
 * @author terratack
 *
 */
public class PokerApplet extends JApplet implements ActionListener {
	public JButton[] karta;
	private JButton start;
	private JLabel pomoc;
	public JPanel stol, karty;
    PrintWriter out = null;
    Socket server = null;
    BufferedReader in = null;
	public PokerApplet() throws UnknownHostException, IOException{
		server = new Socket("localhost",60000);
		this.out = new PrintWriter(server.getOutputStream(), true);
		stol = new JPanel();
		stol.setSize(400,400);
		stol.setBackground(Color.GREEN);
		this.add(stol,BorderLayout.CENTER);
		
		start =  new JButton("START");
		stol.add(start, BorderLayout.NORTH);
		
		karty = new JPanel();
		karty.setPreferredSize(new Dimension(500, 200));
		this.add(karty, BorderLayout.SOUTH);
		karty.setLayout(new GridLayout(1,5));
		karta = new JButton[5];
		for(int i = 0; i < 5; i++){
			karta[i] = new JButton();
			karta[i].setPreferredSize(new Dimension(40, 40));
			karty.add(karta[i]);
		}
		
		this.setVisible(true);
	}
	public void init(){
		PokerApplet okno;
		try {
			okno = new PokerApplet();
			okno.setPreferredSize(new Dimension(500, 500));
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	@Override
	public void actionPerformed(ActionEvent ae) {
		Object sender = ae.getSource();
		if(sender == start){
			out.println("start");
		}
		
	}

}
